package com.hyy.book2.controller;

import com.hyy.book2.service.UserService;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Slf4j
//@RestController
@RestController
@RequestMapping("/user")
public class UserController {





    @Autowired
    private UserService userService;


    //直接拿给service层进行判断
    @RequestMapping("/login")
    public Boolean login(@RequestParam String name,
                         @RequestParam String password,
                         HttpSession session) {
        //打印日志
        log.info("进入user/login接口");
        Boolean result=userService.checkByNameAndPassword(name,password,session);
        log.info("登录结果：name={},result={}",name,result);
        return result;
    }



}
